" Configuration file for vim
set modelines=0		" CVE-2007-2438

" Normally we use vim-extensions. If you want true vi-compatibility
" remove change the following statements
set nocompatible	" Use Vim defaults instead of 100% vi compatibility
"不兼容vi模式"
set backspace=2		" more powerful backspacing

" Don't write backup file if vim is being called by "crontab -e"
au BufWrite /private/tmp/crontab.* set nowritebackup nobackup
" Don't write backup file if vim is being called by "chpass"
au BufWrite /private/etc/pw.* set nowritebackup nobackup

let skip_defaults_vim=1
set mouse=a
"开启鼠标定位
syntax on
"开启语法高亮"
set number
"显示行号"
set tabstop=4
"按tap键自动缩进4个空格"
set softtabstop=4
"tap转为4个空格"
set shiftwidth=4
"按》增加一级缩进 按《取消一级缩机 按==取消全部缩进,每一级的字符数"
set autoindent
"换行自动缩进"
set cindent
"按照C语言语法缩进,自动调整缩机长度"
set cursorline
"光标所在行高亮"
set ruler
"在状态栏显示光标的当前位置（位于哪一行哪一列）"
set nobackup
"不创建备份文件。默认情况下，文件保存时，会额外创建一个备份文件，它的文件名是在原文件名的末尾，再添加一个波浪号（〜）"
filetype plugin indent on
"开启文件类型检查，并且载入与该类型对应的缩进规则"

call plug#begin('~/.vim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
"coc.nvim让vim能够使用vscode的功能"
Plug 'preservim/nerdtree'
"左侧文件管理器
Plug 'Xuyuanp/nerdtree-git-plugin'
"文件管理器的git插件"
Plug 'vim-airline/vim-airline'
"底部状态栏"
Plug 'vim-airline/vim-airline-themes'
"状态栏主题插件"
Plug 'jiangmiao/auto-pairs'
"括号自动补齐"
Plug 'kien/ctrlp.vim'
"模糊查找类似ctrlp"
Plug 'mhinz/vim-startify'
"打开界面
Plug 'ryanoasis/vim-devicons'
" 图标
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
"vim的golang插件
Plug 'Yggdroot/indentLine'
" 垂直对齐线
call plug#end()

set encoding=UTF-8
" 设置编码

"nerdtree配置文件"
autocmd VimEnter * cd %:p:h
"自动打开文件所在目录
map <C-n> :NERDTreeToggle<CR>
"开启/关闭nerdtree
let NERDTreeShowLineNumbers=1
"显示行号
let g:NERDTreeDirArrowExpandable = '►'
let g:NERDTreeDirArrowCollapsible = '▼'
let NERDTreeAutoCenter=1
"修改树的显示图标
let NERDTreeShowHidden=1
"默认忽略显示的文件
let NERDTreeIgnore=['\.pyc','\~$','\.swp','\.git']
"忽略的文件类型
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
"当NERDTree为剩下的唯一窗口时自动关闭

" coc设置
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
" tap自动补齐
" airline设置
let g:airline_theme = 'badwolf'
"设置airline主题
let g:airline_powerline_fonts = 1
" 使用powerline打过补丁的字体
let g:airline#extensions#tabline#enabled = 1
" 开启tabline
let g:airline#extensions#tabline#buffer_nr_show = 1
" tabline中buffer显示编号
let g:airline#extensions#tabline#left_sep = ' '
" tabline中当前buffer两端的分隔字符
let g:airline#extensions#tabline#left_alt_sep = ' '
" tabline中未激活buffer两端的分隔字符
